package com.xiangyu.orderservice.controller;

import com.commonmodule.commonmodule.module.Order;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * @author zxb
 * @version 1.0
 * @date 2025-04-02 16:32
 */
@RestController
@RequestMapping("/order")
@RefreshScope  // 读取配置文件的注解
public class OrderController {

    // 从nacos配置中心获取配置信息
    @Value("${config.info}")
    private String configInfo;

    @GetMapping
    public void getOrder() {
        System.out.println("获取顶单列表！！！");
    }

    @GetMapping("/configInfo")
    public void configInfo(){
        System.out.println(configInfo);
    }

    @PostMapping("/orderUser")
    public void orderUser(@RequestBody Order order) {
        System.out.println("远程调用orderService服务成功");
        System.out.println(order);
    }

}
